<?php
// +----------------------------------------------------------------------
// | Author: Stupboy King
// +----------------------------------------------------------------------
namespace app\api\model;
use app\api\model\Common;
class OrderGps extends Common
{
    /**
     * 
     * @param string $type  GPS数据类型
     * @param int $order_id 订单id
     * @param float $lon 经度
     * @param float $lat 纬度
     * @param string $addr 地址
     */
    public function addOrderGPS($type='driver_',$order_id=0,$lon=0,$lat=0,$addr='', $mile=0 , $pic = '' ){
        $data[$type.'lon']  = $lon;
        $data[$type.'lat']  = $lat;
        $data[$type.'addr'] = $addr;
        if($type=='wait_'){
            $data['start_mile'] = $mile;
            $data['start_pic']  = $pic;
        }
        if($type=='arrival_'){
            $data['end_mile'] = $mile;
            $data['end_pic']  = $pic;
        }
        $data[$type.'time'] = date('Y-m-d H:i:s');
        $this->save($data,['order_id'=>$order_id]);
    }
}